﻿<UserControl x:Class="PrismEx.SampleApp.Modules.ParameterizedNavigation.ListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">

    <ItemsControl ItemsSource="{Binding Customers}">
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <Rectangle x:Name="customerGlyph" Width="16" Height="16" Margin="3" Fill="Navy" />
                    <Button Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ItemsControl}}, Path=DataContext.ShowCustomerDetails}" CommandParameter="{Binding}">
                        <Button.Template>
                            <ControlTemplate>
                                <TextBlock VerticalAlignment="Center" TextDecorations="Underline" Cursor="Hand" Foreground="Blue">
                                    <Run Text="{Binding FirstName}" />
                                    <Run Text="{Binding LastName}" />
                                </TextBlock>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                </StackPanel>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding Gender}" Value="Female">
                        <Setter TargetName="customerGlyph" Property="Fill" Value="Pink" />
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</UserControl>
